<?php


namespace app\common\model\mysql;


use think\Model;

class AdminTrade extends Model
{
    protected $autoWriteTimestamp = true;

    public function addSave($savename, $data,$performer)
    {
        $data = explode(',',$data);
        $savename = implode(',',$savename);
        $message = [
            'name' => $data[0],
            'money' => $data[1],
            'text' => $data[2],
            'img' => $savename,
            'performer' => $performer
        ];
       $result = $this->save($message);
       return $result;
    }

    public function updateTrade($id,$field,$value="",$performer)
    {
        $updateGroup = $this->find($id);
        $updateGroup->setAttr($field, $value);
        $updateGroup->setAttr('performer', $performer);
        $updateGroup->save();
        return '更新成功';
    }
}